import React from 'react'

import { Routes, Route } from 'react-router-dom'

import LoginPage from './pages/LoginPage'
import MainPage from './pages/MainPage'
import NeedAuth from './components/needauth/NeedAuth'



import RegisterPage from './pages/RegisterPage.js'
import AccountRecord from './components/account/AccountRecord.js'
import NoAuth from './components/needauth/NoAuth.js'
import NeedRole from './components/needauth/NeedRole.js'
import PasswordEdit from './components/account/PasswordEdit'
import AvaterEdit from './components/account/AvaterEdit.js'

import DmProjects from './components/datamonitorprojects/DmProjects.js'
import DmDBCProjects from './components/datamonitorprojects/DmDBCProjects.js'
import PublicProps from './components/datamonitorprojects/PublicProps.js'
import BeginMonitor from './components/datamonitorprojects/BeginMonitor.js'
import DBCBeginMonitor from './components/datamonitorprojects/DBCBeginMonitor.js'
import VersionHistory from './components/account/VersionHistory.js'
import VersionTimeLine from './components/account/VersionTimeLine.js'





const App = () => {

  return (
    <Routes>
      <Route path="/" element={<LoginPage />} />
      <Route path="/datamonitor/login" element={<LoginPage />}></Route >

      {/* 可以嵌套路由，当访问main/allgoods就会显示allgoodspage组件 */}
      <Route path="/datamonitor/main" element={<NeedAuth><MainPage /></NeedAuth>}>

        <Route path="dmprojects" element={<NeedAuth><DmProjects /></NeedAuth>}></Route>
        <Route path="dmdbcprojects" element={<NeedAuth><DmDBCProjects /></NeedAuth>}></Route>
        <Route path="dmpublicprops" element={<NeedAuth><PublicProps /></NeedAuth>}></Route>
        <Route path="passwordedit" element={<NeedAuth><PasswordEdit /></NeedAuth>}></Route>
        <Route path="avateredit" element={<NeedAuth><AvaterEdit /></NeedAuth>}></Route>

        <Route path="accountsetup" element={<NeedRole><AccountRecord /></NeedRole>}></Route>
        <Route path="versionhistory" element={<NeedRole><VersionHistory /></NeedRole>}></Route>
        <Route path="versiontimeline" element={<NeedAuth><VersionTimeLine /></NeedAuth>}></Route>
        <Route path="noauth" element={<NoAuth />}></Route >
      </Route >

      {/* <Route path="/IMS/test" element={<Tlogin />}>
      </Route > */}
      <Route path="/datamonitor/register" element={<RegisterPage />}></Route >
      <Route path="/datamonitor/beginmonitor" element={<NeedAuth><BeginMonitor /></NeedAuth>}></Route>
      <Route path="/datamonitor/dbcbeginmonitor" element={<NeedAuth><DBCBeginMonitor /></NeedAuth>}></Route>
    </Routes>

  )
}

export default App


